//
//  RCTBridgeModule.m
//  liveNativeRN
//
//  Created by 李玉臣 on 2018/4/26.
//  Copyright © 2018年 Facebook. All rights reserved.
//

#import "RNNotificationBridgeModule.h"

@implementation RNNotificationBridgeModule
{
  NSDictionary *_resourceFilter;
}
- (instancetype)init{
  if (self = [super init]) {

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tabbarShow) name:@"TABBAR_SHOW" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tabbarHidden) name:@"TABBAR_HIDDEN" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(logout) name:@"LOGIN_OUT" object:nil];


  }
  return self;
}

@synthesize bridge = _bridge;

RCT_EXPORT_MODULE(RNNotificationBridgeModule);




- (void)tabbarShow{
  [self sendEventWithName:@"TABBAR_SHOW" body:nil];
}

- (void)tabbarHidden{

  [self sendEventWithName:@"TABBAR_HIDDEN" body:nil];
}

- (void)logout{
  [self sendEventWithName:@"LOGIN_OUT" body:nil];
}

- (NSArray<NSString *> *)supportedEvents{
  return @[@"TABBAR_SHOW",
           @"TABBAR_HIDDEN",
           @"LOGIN_OUT"];
}

-(void)dealloc{
  
  [[NSNotificationCenter defaultCenter] removeObserver:self];
}

@end
